<?php
	function putAccount($empID,$AccName,$AccPass,$ManagerID,$ManagerPass)
	{
		//echo $empID;
		$conn = new mysqli('localhost', 'root', '', 'SEVENBITS'); 
		$sql = "INSERT INTO `employees` (`EmpID`, `ManagerID`) VALUES ('$empID','$ManagerID')";
		$conn->query($sql);
		$sql = "INSERT INTO `account`(`EmpID`, `AccName`, `UPassword`) VALUES('$empID','$AccName','$AccPass')";
		$conn->query($sql);
		return ("Sucessful");
		$conn->close();
	}
	function dozasMeethod(){
		$args[] = getArgs();
		
	}
	
	function putAccounts($AccName,$AccPass,$ManagerID,$ManagerPass,$dataHash) // for now data hash is bool
	{
		$conn = new mysqli('localhost', 'root', '', 'SEVENBITS'); 
		$sql = "Update `account`
		SET `UPassword` = '$AccPass'
		WHERE`AccName` = '$AccName'
		";
		$conn->query($sql);
		//echo $empID;
		//echo $AccName;
		echo "Sucessful";
		$conn->close();
	}
	function deleteAccount($AccName,$ManagerID,$ManagerPass)
	{
		$conn = new mysqli('localhost', 'root', '', 'SEVENBITS'); 
		$sql = "DELETE FROM `account` WHERE `AccName` = '$AccName'";
		$conn->query($sql);
		return "Sucessful";
		$conn->close();
	}
	function getAccounts($ManagerID,$ManagerPass)
	{
	$conn = new mysqli('localhost', 'root', '', 'SEVENBITS');
		$sql = "SELECT `AccName` FROM Account";
		$Array = array();
		$counter = 0;
		$result =$conn->query($sql);
		if($blah = $conn->query($sql)){
			while($row = $blah->fetch_assoc()) {
				array_push($Array, $row["AccName"]);
				//echo '<br /> id: '. $row['id']. ' - name: '. $row['name'] ;
		
		
			}
		}
		return json_encode($Array);
		$conn->close();
}
	// display all accounts. Arr(result obj, account name, hash, accountname, hash, etc.)
	
?>